#lang racket


(require scribble/base-render)

(require "googlewiki-render-mixin.rkt")

(provide make-googlewiki-doc)


(define (render-googlewiki-docs docs filenames dest-dir fig-urls append-paths)
  (let ([renderer (new (googlewiki-render-mixin render% fig-urls append-paths) [dest-dir dest-dir])])
    (let* ([fp (send renderer traverse docs filenames)]
           [info (send renderer collect docs filenames fp)]
           [r-info (send renderer resolve docs filenames info)])
      (send renderer render docs filenames r-info))))

(define (make-googlewiki-doc scribble-path wiki-name wiki-dir fig-urls append-paths)
  (render-googlewiki-docs
   (list (dynamic-require `(file ,(path->string scribble-path)) 'doc))
   (list (path->string (build-path wiki-dir wiki-name)))
   wiki-dir
   fig-urls
   append-paths))

;(render-googlewiki-docs
; (list
;  (dynamic-require `(file "C:\\Users\\joe\\Desktop\\TeseWork\\RosettaExamples\\distros\\shelter\\doc\\shelter.scrbl") 'doc)
;  (dynamic-require `(file "C:\\Users\\joe\\Desktop\\TeseWork\\RosettaExamples\\distros\\shelter\\doc\\shelter2.scrbl") 'doc))
; (list
;  "C:\\Users\\joe\\Desktop\\TeseWork\\RosettaExamples\\distros\\shelter\\doc\\Shelter.wiki"
;  "C:\\Users\\joe\\Desktop\\TeseWork\\RosettaExamples\\distros\\shelter\\doc\\Shelter2.wiki")
; "C:\\Users\\joe\\Desktop\\TeseWork\\RosettaExamples\\distros\\shelter\\doc")

;(make-googlewiki-doc
; (build-path "C:\\Users\\joe\\Desktop\\TeseWork\\RosettaExamples\\distros\\shelter\\doc\\shelter.scrbl")
; "Shelter.wiki"
; (build-path "C:\\Users\\joe\\Desktop\\TeseWork\\RosettaExamples\\distros\\shelter\\doc"))